/**
 * 
 */
package uk.ac.ebi.velvet.model.impl;

import java.util.ArrayList;
import java.util.List;

import uk.ac.ebi.velvet.model.ContigData;
import uk.ac.ebi.velvet.model.MapLocation;

/**
 * @author mhaimel
 *
 */
public class ContigDataImpl implements ContigData {

	private int length = -1;
	private int identifier = -1;
	private long filePosition = -1L;
	private List<MapLocation> mapLoc;
	
	public ContigDataImpl() {
		super();
		mapLoc = new ArrayList<MapLocation>();
	}
	
	public ContigDataImpl(Integer identifier, Integer length) {
		this();
		this.identifier = identifier;
		this.length = length;
	}
	
	public void setLength(Integer length) {
		this.length = length;
	}

	public void setIdentifier(Integer identifier) {
		this.identifier = identifier;
	}

	@Override
	public int getIdentifier() {
		return identifier;
	}

	@Override
	public int getLength() {
		return length;
	}

	@Override
	public void addMapLocation(MapLocation loc){
		this.mapLoc.add(loc);
	}

	@Override
	public Iterable<MapLocation> getMapLocations() {
		return mapLoc;
	}

	@Override
	public long getFilePosition() {
		return filePosition;
	}
	
	public void setFilePosition(long fileLocation) {
		this.filePosition = fileLocation;
	}
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + identifier;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContigDataImpl other = (ContigDataImpl) obj;
		if (identifier != other.identifier)
			return false;
		return true;
	}
}
